package com.chenl.provider.DEMOS.JWT;

import com.chenl.provider.DTO.UserInfo;
import com.chenl.provider.util.SsoJwtUtils;
import com.google.common.collect.Lists;
import io.jsonwebtoken.Claims;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RequestMapping("/jwt")
@RestController
@ConfigurationProperties(prefix = "chenling")
public class testJwtCon {
    public static void main(String[] args) {
        UserInfo userInfo=new UserInfo();
        List<UserInfo> userInfos = Lists.newArrayList(userInfo);
        System.out.println(userInfos);
    }
    @Autowired
    SsoJwtUtils ssoJwtUtils;

//    @Value("${test.test}")
    private String value;

    @Value("")
    private String name;
    @GetMapping("/test")
    public String test(@RequestParam String token){
//        Claims claimByToken = ssoJwtUtils.getClaimByToken(token);
//        System.out.println(claimByToken.toString());
//        System.out.println(ssoJwtUtils.isTokenExpired(token));
        return value;
    }
}
